<template>
  <div class="container">
    <div class="header">
      <div class="header-content">
        <div class="logo">
          <i class="fa fa-cubes mr-2"></i>
          <span>企业管理系统</span>
        </div>
        
        <div class="header-actions">
          <div class="search-bar">
            <input type="text" placeholder="搜索..." />
            <i class="fa fa-search"></i>
          </div>
          
          <div class="user-menu">
            <div class="user-info">
              <img src="https://picsum.photos/id/1005/40/40" alt="用户头像" class="user-avatar" />
              <span class="user-name">管理员</span>
              <i class="fa fa-angle-down ml-1"></i>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="main">
      <div class="side">
        <router-link to="/user">用户管理</router-link>
        <router-link to="/power">权限管理</router-link>
        <router-link to="/goods">商品管理</router-link>
        <router-link to="/order">订单管理</router-link>
        <router-link to="/system">系统管理</router-link>
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
    <div class="footer">
      <div class="copyright">
        <p>© 2025 企业管理系统 版权所有</p>
        <p>备案号：粤ICP备12345678号-1</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  // 父组件逻辑
}
</script>

<style global>
  /* 全局重置 */
  * { margin: 0; padding: 0; box-sizing: border-box; }
</style>

<style scoped>
/* 基础布局 */
.container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh; /* 铺满屏幕高度 */
}

.header {
  background: linear-gradient(90deg, #165DFF 0%, #3B82F6 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  max-width: 1920px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  transition: background-color 0.2s;
  width: 240px;
}

.search-bar:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.search-bar input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  outline: none;
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-bar i {
  margin-left: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
}

.user-menu {
  position: relative;
}

.user-info {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.user-info:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-name {
  font-size: 0.9rem;
  font-weight: 400;
}

.main {
  display: flex;
  flex: 1;
}

.side {
  width: 20%;
  background-color: #f0f2f5;
  padding: 1rem;
}

.content {
  width: 80%;
  padding: 1rem;
  background-color: white;
}

.footer {
  background-color: #f8fafc;
  padding: 0.75rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.8rem;
  border-top: 1px solid #e2e8f0;
}

/* 版权信息样式 */
.copyright p {
  margin: 0.25rem 0;
}

/* 导航链接样式 */
.side a {
  display: block;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.side a:hover {
  background-color: #e6e8eb;
}

.side a.router-link-exact-active {
  background-color: #d9e3f9;
  color: #165DFF;
  font-weight: 500;
}

/* 确保下拉菜单容器有定位上下文 */
.user-dropdown {
  position: relative;
}
</style>    